package com.hutao.manage;

import javax.servlet.MultipartConfigElement;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;

import com.hutao.manage.datasource.DynamicDataSourceRegister;

@SpringBootApplication
@Import({ DynamicDataSourceRegister.class })
@MapperScan(basePackages = "com.hutao.manage.mapper")
public class MedicalManageApplication extends SpringBootServletInitializer {

	public static void main(String[] args) {

		SpringApplication.run(MedicalManageApplication.class, args);
	}

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(MedicalManageApplication.class);
	}
	

    /**  
     * 文件上传配置  
     * @return  
     */  
    @Bean  
    public MultipartConfigElement multipartConfigElement() {  
        MultipartConfigFactory factory = new MultipartConfigFactory();  
        //单个文件最大  
        factory.setMaxFileSize("512000KB"); //KB,MB  
        /// 设置总上传数据总大小  
        //factory.setMaxRequestSize("2048000KB"); 
        factory.setMaxRequestSize("3145728KB"); //3G
        return factory.createMultipartConfig();  
    }

}
